home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / keymas_1 / frmdemo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-10-15  |  8.6 KB  |  293 lines

  1. VERSION 5.00
  2. Object = "{217F60B4-4487-11D1-9976-400097037212}#1.0#0"; "Keymaster.ocx"
  3. Begin VB.Form frmDemo 
  4.    Caption         =   "Keymaster Demonstration"
  5.    ClientHeight    =   7755
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   10650
  9.    Icon            =   "frmDemo.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   7755
  12.    ScaleWidth      =   10650
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton Command1 
  15.       Height          =   255
  16.       Left            =   4560
  17.       TabIndex        =   24
  18.       Top             =   3000
  19.       Width           =   375
  20.    End
  21.    Begin VB.CommandButton cmdViewRegistry 
  22.       Height          =   255
  23.       Left            =   4560
  24.       TabIndex        =   22
  25.       Top             =   2520
  26.       Width           =   375
  27.    End
  28.    Begin VB.CommandButton cmdSeeValue 
  29.       Height          =   255
  30.       Left            =   4560
  31.       TabIndex        =   21
  32.       Top             =   2040
  33.       Width           =   375
  34.    End
  35.    Begin VB.CommandButton cmdDeleteValue 
  36.       Height          =   255
  37.       Left            =   4560
  38.       TabIndex        =   18
  39.       Top             =   1560
  40.       Width           =   375
  41.    End
  42.    Begin VB.CommandButton cmdSetValue 
  43.       Height          =   255
  44.       Left            =   4560
  45.       TabIndex        =   16
  46.       Top             =   1080
  47.       Width           =   375
  48.    End
  49.    Begin VB.CommandButton cmdDeleteKey 
  50.       Height          =   255
  51.       Left            =   4560
  52.       TabIndex        =   14
  53.       Top             =   600
  54.       Width           =   375
  55.    End
  56.    Begin VB.CommandButton cmdCreateKey 
  57.       Height          =   255
  58.       Left            =   4560
  59.       TabIndex        =   12
  60.       Top             =   120
  61.       Width           =   375
  62.    End
  63.    Begin VB.TextBox txtValue 
  64.       Height          =   375
  65.       Left            =   1560
  66.       TabIndex        =   6
  67.       Top             =   3060
  68.       Width           =   2415
  69.    End
  70.    Begin VB.TextBox txtValueName 
  71.       Height          =   405
  72.       Left            =   1560
  73.       TabIndex        =   5
  74.       Top             =   2469
  75.       Width           =   2415
  76.    End
  77.    Begin VB.TextBox txtSubkey 
  78.       Height          =   405
  79.       Left            =   1560
  80.       TabIndex        =   4
  81.       Top             =   1893
  82.       Width           =   2415
  83.    End
  84.    Begin VB.TextBox txtRootKey 
  85.       Height          =   405
  86.       Left            =   1560
  87.       TabIndex        =   3
  88.       Top             =   1317
  89.       Width           =   2415
  90.    End
  91.    Begin VB.TextBox txtReturnValue 
  92.       Height          =   405
  93.       Left            =   1560
  94.       TabIndex        =   2
  95.       Top             =   720
  96.       Width           =   2415
  97.    End
  98.    Begin VB.TextBox txtLastError 
  99.       Height          =   375
  100.       Left            =   1560
  101.       TabIndex        =   1
  102.       Top             =   120
  103.       Width           =   2415
  104.    End
  105.    Begin KEYMASTERLib.KeyMaster KeyMaster1 
  106.       Left            =   120
  107.       Top             =   7080
  108.       _Version        =   65536
  109.       _ExtentX        =   661
  110.       _ExtentY        =   661
  111.       _StockProps     =   0
  112.    End
  113.    Begin VB.Label Label13 
  114.       Caption         =   "Exit"
  115.       Height          =   255
  116.       Left            =   5160
  117.       TabIndex        =   25
  118.       Top             =   3000
  119.       Width           =   1215
  120.    End
  121.    Begin VB.Label Label12 
  122.       Caption         =   "View Registry"
  123.       Height          =   255
  124.       Left            =   5160
  125.       TabIndex        =   23
  126.       Top             =   2520
  127.       Width           =   1215
  128.    End
  129.    Begin VB.Label Label11 
  130.       Caption         =   "View Value"
  131.       Height          =   255
  132.       Left            =   5160
  133.       TabIndex        =   20
  134.       Top             =   2040
  135.       Width           =   1215
  136.    End
  137.    Begin VB.Label Label10 
  138.       Caption         =   "Delete Value"
  139.       Height          =   255
  140.       Left            =   5160
  141.       TabIndex        =   19
  142.       Top             =   1560
  143.       Width           =   1215
  144.    End
  145.    Begin VB.Label Label9 
  146.       Caption         =   "Set Value"
  147.       Height          =   255
  148.       Left            =   5160
  149.       TabIndex        =   17
  150.       Top             =   1080
  151.       Width           =   1215
  152.    End
  153.    Begin VB.Label Label8 
  154.       Caption         =   "Delete Key"
  155.       Height          =   255
  156.       Left            =   5160
  157.       TabIndex        =   15
  158.       Top             =   600
  159.       Width           =   1215
  160.    End
  161.    Begin VB.Label Label7 
  162.       Caption         =   "Create Key"
  163.       Height          =   255
  164.       Left            =   5160
  165.       TabIndex        =   13
  166.       Top             =   120
  167.       Width           =   1215
  168.    End
  169.    Begin VB.Label Label6 
  170.       Caption         =   "Value:"
  171.       Height          =   255
  172.       Left            =   120
  173.       TabIndex        =   11
  174.       Top             =   3120
  175.       Width           =   1215
  176.    End
  177.    Begin VB.Label Label5 
  178.       Caption         =   "Value Name:"
  179.       Height          =   255
  180.       Left            =   120
  181.       TabIndex        =   10
  182.       Top             =   2544
  183.       Width           =   1215
  184.    End
  185.    Begin VB.Label Label4 
  186.       Caption         =   "Subkey:"
  187.       Height          =   255
  188.       Left            =   120
  189.       TabIndex        =   9
  190.       Top             =   1968
  191.       Width           =   1215
  192.    End
  193.    Begin VB.Label Label3 
  194.       Caption         =   "Root Key:"
  195.       Height          =   255
  196.       Left            =   120
  197.       TabIndex        =   8
  198.       Top             =   1392
  199.       Width           =   1215
  200.    End
  201.    Begin VB.Label Label2 
  202.       Caption         =   "Return Value:"
  203.       Height          =   255
  204.       Left            =   120
  205.       TabIndex        =   7
  206.       Top             =   816
  207.       Width           =   1095
  208.    End
  209.    Begin VB.Label Label1 
  210.       Caption         =   "Last Error:"
  211.       Height          =   255
  212.       Left            =   120
  213.       TabIndex        =   0
  214.       Top             =   240
  215.       Width           =   855
  216.    End
  217. Attribute VB_Name = "frmDemo"
  218. Attribute VB_GlobalNameSpace = False
  219. Attribute VB_Creatable = False
  220. Attribute VB_PredeclaredId = True
  221. Attribute VB_Exposed = False
  222. Function Switch(TextVal As String) As Long
  223. Select Case TextVal
  224.     Case "HKEY_CLASSES_ROOT"
  225.         Switch = HKEY_CLASSES_ROOT
  226.     Case "HKEY_CURRENT_USER"
  227.         Switch = HKEY_CURRENT_USER
  228.     Case "HKEY_LOCAL_MACHINE"
  229.         Switch = HKEY_LOCAL_MACHINE
  230.     Case "HKEY_USERS"
  231.         Switch = HKEY_USERS
  232.     Case "HKEY_PERFORMANCE_DATA"
  233.         Switch = HKEY_PERFORMANCE_DATA
  234.     Case "HKEY_CURRENT_CONFIG"
  235.         Switch = HKEY_CURRENT_CONFIG
  236.     Case "HKEY_DYN_DATA"
  237.         Switch = HKEY_DYN_DATA
  238. End Select
  239. End Function
  240. Private Sub cmdCreateKey_Click()
  241. Dim RetVal As Long
  242. KeyMaster1.RootKey = Switch(txtRootKey.Text)
  243. KeyMaster1.SubKey = txtSubkey.Text
  244. RetVal = KeyMaster1.CreateKey
  245. txtReturnValue = Trim(Str(RetVal))
  246. txtLastError.Text = KeyMaster1.LastError
  247. End Sub
  248. Private Sub cmdDeleteKey_Click()
  249. Dim RetVal As Long
  250. KeyMaster1.RootKey = Switch(txtRootKey.Text)
  251. KeyMaster1.SubKey = txtSubkey.Text
  252. RetVal = KeyMaster1.DeleteKey
  253. txtReturnValue.Text = Trim(Str(RetVal))
  254. txtLastError.Text = KeyMaster1.LastError
  255. End Sub
  256. Private Sub cmdDeleteValue_Click()
  257. Dim RetVal As Long
  258. KeyMaster1.RootKey = Switch(txtRootKey.Text)
  259. KeyMaster1.SubKey = txtSubkey.Text
  260. KeyMaster1.ValueName = txtValueName.Text
  261. KeyMaster1.Value = txtValue.Text
  262. RetVal = KeyMaster1.DeleteValue
  263. txtReturnValue.Text = Trim(Str(RetVal))
  264. txtLastError.Text = KeyMaster1.LastError
  265. End Sub
  266. Private Sub cmdSeeValue_Click()
  267. Dim RetVal As Long
  268. KeyMaster1.RootKey = Switch(txtRootKey.Text)
  269. KeyMaster1.SubKey = txtSubkey.Text
  270. KeyMaster1.ValueName = txtValueName.Text
  271. KeyMaster1.Value = txtValue.Text
  272. RetVal = KeyMaster1.GetValue
  273. txtReturnValue.Text = Trim(Str(RetVal))
  274. txtLastError.Text = KeyMaster1.LastError
  275. txtValue.Text = KeyMaster1.Value
  276. End Sub
  277. Private Sub cmdSetValue_Click()
  278. Dim RetVal As Long
  279. KeyMaster1.RootKey = Switch(txtRootKey.Text)
  280. KeyMaster1.SubKey = txtSubkey.Text
  281. KeyMaster1.ValueName = txtValueName.Text
  282. KeyMaster1.Value = txtValue.Text
  283. RetVal = KeyMaster1.SetValue
  284. txtReturnValue.Text = Trim(Str(RetVal))
  285. txtLastError.Text = KeyMaster1.LastError
  286. End Sub
  287. Private Sub cmdViewRegistry_Click()
  288. Shell ("regedit")
  289. End Sub
  290. Private Sub Command1_Click()
  291. Unload Me
  292. End Sub
  293.